import Vue from "vue";
import VueRouter from "vue-router";
import Home from "../views/Home.vue";
Vue.use(VueRouter);
const originalPush = VueRouter.prototype.push

VueRouter.prototype.push = function push(location) {
  return originalPush.call(this, location).catch(err => err)
}

const routes = [

  {
    path: "/",
    name: "Home",
    component: Home,
  },
  {
    path: "/about",
    name: "About",
    // route level code-splitting
    // this generates a separate chunk (about.[hash].js) for this route
    // which is lazy-loaded when the route is visited.
    component: () =>
      import(/* webpackChunkName: "about" */ "../views/About.vue"),
  },
  {
    path: "/Login",
    name: "Login",
    // route level code-splitting
    // this generates a separate chunk (about.[hash].js) for this route
    // which is lazy-loaded when the route is visited.
    component: () =>
        import(/* webpackChunkName: "about" */ "../page/Login.vue"),
  },
  {
    path: "/Index",
    name: "Index",
    component: () => import("../page/Index.vue"),
    children:[
      {
        path: "/user/page",
        name: "User",
        component: () => import("../page/User.vue"),
      },
      {
        path: "/role/page",
        name: "Role",
        component: () => import("../page/Role.vue"),
      },
      {
        path: "/menu/page",
        name: "Menu",
        component: () => import("../page/Menu.vue"),
      },
      {
        path: "/Dept",
        name: "Dept",
        component: () => import("../page/Dept.vue"),
      },
      {
        path: "/SubjectMenu",
        name: "SubjectMenu",
        component: () => import("../page/SubjectMenu.vue"),
      },


      {
        path: "/table/page",
        name: "Table",
        component: () => import("../page/Table.vue"),
      },
      {
        path: "/teacher/page",
        name: "Teacher",
        component: () => import("../page/CheckTeacher.vue"),
      },
      {
        path: "/zone/page",
        name: "Zone",
        component: () => import("../page/Zone.vue"),
      },
      {
        path: "/zoneCourse/page",
        name: "ZoneCourse",
        component: () => import("../page/ZoneCourse.vue"),
      },
      {
        path: "/link/page",
        name: "Link",
        component: () => import("../page/Link.vue"),
      },
    ]    
  },
];

const router = new VueRouter({
  routes,
});

export default router;
